package com.example.login.controller;

import com.example.login.entity.Result;
import com.example.login.service.UserServiceImp;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/*
负责具体的业务模块流程的控制，主要调用service层里面的接口控制具体的业务流程
 */
@CrossOrigin
@RestController
public class UserController {
    @Resource
    private UserServiceImp userService;
    //登录服务
    @RequestMapping("login")
    public Result userLogin(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> loginInfo){
        Result<Map<String, Integer>> result = userService.login(request,response,loginInfo);
        return result;
    }


    //获取用户信息
    @RequestMapping("getUserInfo")
    public Result getUserInfo(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> reqInfo){
        return userService.getUserInfo(request,response,reqInfo);
    }



}

